var app = getApp(),
  api = app.api;

Page({
  data: {
    daipeisong: 0,
    peisongzhong: 0,
    yiwancheng: 0,
    total: 0,
    mch: {}
  },
  onLoad: function(e) {
    getApp().page.onLoad(this, e);
    this.setData({
      custom: getApp().core.getStorageSync(getApp().const.CUSTOM)
    });
  },
  onReady: function() {
    getApp().page.onReady(this);
  },
  onShow: function() {
    getApp().page.onShow(this);
    var e = this,
      t = getApp().core.getStorageSync(getApp().const.SHARE_SETTING),
      a = e.data.__user_info;
    e.loadData();
  },
  copyinfo: function (e) {
    this.currentPage;
    getApp().core.setClipboardData({
      data: e.target.dataset.info,
      success: function (e) {
        getApp().core.showToast({
          title: "复制成功！",
          icon: "success",
          duration: 2e3,
          mask: !0
        });
      }
    });
  },
  loadData: function() {
    var a = this;
    getApp().core.showLoading({
      title: "正在加载",
      mask: !0
    }), getApp().request({
      url: getApp().api.user.get_delivery_info,
      success: function(e) {
        if (0 == e.code) {
          a.setData({
            daipeisong: e.data.daipeisong,
            peisongzhong: e.data.peisongzhong,
            yiwancheng: e.data.yiwancheng,
            mch: e.data.mch,
            total: parseInt(e.data.daipeisong) + parseInt(e.data.peisongzhong) + parseInt(e.data.yiwancheng)
          });
        }
        console.log(a.data.mch);
      },
      complete: function() {
        getApp().core.hideLoading();
      }
    });
  }
});